package com.foreverwin.mes.lims.service.impl;

import com.foreverwin.mes.core.base.FrontPage;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.foreverwin.mes.lims.mapper.DefeRecodesOfWorkInProcMapper;
import com.foreverwin.mes.lims.model.DefeRecodesOfWorkInProc;
import com.foreverwin.mes.lims.service.DefeRecodesOfWorkInProcService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mark
 * @since 2020-02-17
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DefeRecodesOfWorkInProcServiceImpl extends ServiceImpl<DefeRecodesOfWorkInProcMapper, DefeRecodesOfWorkInProc> implements DefeRecodesOfWorkInProcService {


    @Autowired
    private DefeRecodesOfWorkInProcMapper defeRecodesOfWorkInProcMapper;

    @Override
    public Page<DefeRecodesOfWorkInProc> selectPage(FrontPage<DefeRecodesOfWorkInProc> frontPage, DefeRecodesOfWorkInProc defeRecodesOfWorkInProc) {
        EntityWrapper<DefeRecodesOfWorkInProc> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(defeRecodesOfWorkInProc);
        return super.selectPage(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<DefeRecodesOfWorkInProc> selectList(DefeRecodesOfWorkInProc defeRecodesOfWorkInProc) {
        EntityWrapper<DefeRecodesOfWorkInProc> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(defeRecodesOfWorkInProc);
        return super.selectList(queryWrapper);
    }

    @Override
    public List<DefeRecodesOfWorkInProc> getResourceAndOperation(DefeRecodesOfWorkInProc defeRecodesOfWorkInProc) {
        return defeRecodesOfWorkInProcMapper.selectResourceAndOperation(defeRecodesOfWorkInProc.getSite());
    }

    public DefeRecodesOfWorkInProc selectByHandle( String handle ){
        return defeRecodesOfWorkInProcMapper.selectByHandle( handle );
    }

}